From: Ian Jackson Date: Mon, 28 Jun 2010 16:13:43 +0000 (+0100) Subject: libxl: Specify no nics to qemu when no emulated nics X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11870 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=4f5a16eb5cc213d9a04bee0c815e7496387e1bd4;p=xen.git libxl: Specify no nics to qemu when no emulated nics qemu will default to one emulated NIC if no network configuration is specified on the command-line. If there are no emualted NICs (i.e., no NICs or all NICs are PV), specify no nics to avoid getting an emulated NIC by default. Signed-off-by: George Dunlap --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 985e9995fc..293aaa7f02 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -858,6 +858,8 @@ static char ** libxl_build_device_model_args(struct libxl_ctx *ctx, flexarray_set(dm_args, num++, info->serial); } if (info->type == XENFV) { + int ioemu_vifs = 0; + if (info->videoram) { flexarray_set(dm_args, num++, "-videoram"); flexarray_set(dm_args, num++, libxl_sprintf(ctx, "%d", info->videoram)); @@ -901,8 +903,14 @@ static char ** libxl_build_device_model_args(struct libxl_ctx *ctx, flexarray_set(dm_args, num++, "-net"); flexarray_set(dm_args, num++, libxl_sprintf(ctx, "tap,vlan=%d,ifname=%s,bridge=%s", vifs[i].devid, vifs[i].ifname, vifs[i].bridge)); + ioemu_vifs++; } } + /* If we have no emulated nics, tell qemu not to create any */ + if ( ioemu_vifs == 0 ) { + flexarray_set(dm_args, num++, "-net"); + flexarray_set(dm_args, num++, "none"); + } } if (info->saved_state) { flexarray_set(dm_args, num++, "-loadvm");